/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#include "Game/Game/ObjectManager.h"
#include "Game/Game/SQLStorages.h"


ObjectManager::ObjectManager(void)
    : _MyplayerXPperLevel()
{

}

ObjectManager::~ObjectManager(void)
{

}

const PlayerInfo *ObjectManager::GetPlayerInfo(std::uint32_t _Race, std::uint32_t _Class)
{
    if (_Race >= MAX_RACES)   { return NULL; }
    if (_Class >= MAX_CLASSES) { return NULL; }
    PlayerInfo const* _Info = &_MyplayerInfo[_Race][_Class];
    if (_Info->DisplayId_M == 0 || _Info->DisplayId_F == 0) { return NULL; }
    return _Info;
}

const struct CreatureInfo* ObjectManager::GetCreatureInfo(std::uint32_t _ID) { return sSQLStorages._MycreatureStorage.LookupEntry<CreatureInfo>(_ID); }
const struct InstanceTemplate* ObjectManager::GetInstanceTemplate(std::uint32_t _ID) { return sSQLStorages._MyinstanceTemplate.LookupEntry<InstanceTemplate>(_ID); }
const struct ItemPrototype* ObjectManager::GetItemPrototype(std::uint32_t _ID) { return sSQLStorages._MyitemStorage.LookupEntry<ItemPrototype>(_ID); }